Control - For Loops
Deitel 4
Control - nested loops
Deitel 5
Part B
☑ Create a class Frog with instance vars energy, an int, and scared, a boolean. (hint: this class has instance vars so it also has...)
☑ Give Frog a method startle, which prints that the Frog was startled, and sets its scared boolean to true.
☑ Give Frog a method hop, which prints "Hopping" a number of times based on the Frog's energy-- so, if its energy was 43, it would print 43 times. Then adjust the code so that if a Frog is scared, it will hop (print) twice as many times as its energy would usually cause (do NOT change the energy; never change an instance variable unless that is the method's job!). (hint: there are several ways to make this adjustment, you will need an if)
☑ Back in your main, create a frog, give it some energy, make it hop, startle it, print it, and then make it hop again.
[EC] In main, use a loop to make Frogs with from 1 to 10 energy, and do the above to each one. (hint, you don't have to store each Frog in a different variable)